package com.itheima.service.pmsService.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.db.pms.PmsProductLadder;
import com.itheima.mapper.pmsMapper.PmsProductLadderMapper;
import com.itheima.service.pmsService.PmsProductLadderService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class PmsProductLadderServiceImpl implements PmsProductLadderService {
    @Autowired
    PmsProductLadderMapper pmsProductLadderMapper;

    @Override
    public void add(PmsProductLadder pmsProductLadder) {
        pmsProductLadderMapper.insert(pmsProductLadder);
    }

    @Override
    public List<PmsProductLadder> getInfoByBrandId(Long id) {
        LambdaQueryWrapper<PmsProductLadder> lqw = new LambdaQueryWrapper<>();
        lqw.eq(PmsProductLadder::getProductId,id);
        return pmsProductLadderMapper.selectList(lqw);
    }

    @Override
    public void update(PmsProductLadder pmsProductLadder) {
        pmsProductLadderMapper.updateById(pmsProductLadder);
    }
}
